package com.kitty.common.schedule.service;

import com.kitty.common.schedule.entity.SpringScheduledCron;
import lombok.extern.slf4j.Slf4j;
import org.nutz.dao.Cnd;
import org.nutz.dao.Dao;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.stereotype.Service;

import java.util.List;

@Slf4j
@Service
public class SpringScheduledCronService {

    @Autowired
    Dao dao;
    @Autowired
    JdbcTemplate jdbcTemplate;



    public List<SpringScheduledCron> findByCronKey(String cron_key) {
        return dao.query(SpringScheduledCron.class, Cnd.where("cron_key","=",cron_key));
    }
    public List<SpringScheduledCron> findByCronType(String type) {
        return dao.query(SpringScheduledCron.class, Cnd.where("task_explain","=",type));
    }

    public List<SpringScheduledCron> findAll() {
        return dao.query(SpringScheduledCron.class, Cnd.where("status","=",1));
    }
}
